package com.dd.web.securities.proxy;

import feign.Headers;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * 获取指数当天分时交易数据代理
 * 使用网易财经接口
 * http://img1.money.126.net/data/hs/time/today/0000016.json
 *  0000016： 其中首位为0 表示深证； 1表示上证；后六位为股票代码
 *
 *  数据结构
 *  {"date":"20200630","symbol":"000016","lastVolume":12593352100,
 *  "data":[
 *      ["0930",4130.0,4130.0,78608400],
 *      ["0931",4132.07,4131.035,336243800],
 *      ["0932",4133.58,4131.883,111765900],
 *      ["0933",4134.7,4132.587,104701400],
 *      ["0934",4133.66,4132.802,108872000],
 *      ["0935",4136.4,4133.402,96045900],
 *      ["0936",4139.04,4134.207,98990900],
 *      ["0937",4138.94,4134.799,91748300],
 *      ["0938",4139.44,4135.314,92425100],
 *      ["0939",4141.1,4135.893,93454700],
 *      ["1119",4147.6,4142.107,29972800],["1120",4147.8,4142.158,31003200],
 *      ["1121",4149.0,4142.219,27086400],["1122",4150.61,4142.293,33548900],
 *      ["1455",4163.23,4150.998,74380900],["1456",4164.41,4151.054,80596200],
 *      ["1457",4164.87,4151.112,10815900],["1458",4164.87,4151.169,0],["1459",4164.87,4151.226,0],
 *      ["1500",4163.96,4151.279,149294700]
 *      ],
 *      "name":"\u6caa\u6df1300","yestclose":4109.72,"count":242}
 *
 */
@Headers("Content-Type: application/json; charset=UTF-8")
@FeignClient(url = "http://img1.money.126.net/data/hs/time/today",name="todayData")
public interface TodayDataProxy {

    /**
     * 获取分时图交易数据
     * @param code
     * @return
     */
    @GetMapping("/{code}.json")
    public ResponseEntity<byte[]> selectTodayDate(@PathVariable("code") String code);
}
